#include <iostream>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <vector>
#include <map>
#include <queue>
#include <cstdio>
#include <string>
#include <stack>
#include <set>
#define IOS ios::sync_with_stdio(false), cin.tie(0)
using namespace std;
typedef long long ll;
ll num[100010],n,m;
const ll INF=0x3f3f3f3f;
bool judge(ll d){
    ll ans=1,ld=1;
    for(ll i=2;i<=n;i++){
        if(num[i]-num[ld]>=d){
            ans++;
            ld=i;
        }
        else {
            while(i<=n&&num[i]-num[ld]<d){
                i++;
            }
            if(i>n)break;
            else {
                ans++;ld=i;
            }
        }
    }
    if(ans>=m)return true;
    else return false;
}

int main()
{
    IOS;
    cin>>n>>m;
    ll minn=INF,maxn=0;
    for(ll i=1;i<=n;i++){
        cin>>num[i];
        // minn=min(minn,num[i]);
        // maxn=max(maxn,num[i]);
    }    
    sort(num+1,num+1+n);
    for(ll i=1;i<=n;i++){
        maxn=max(maxn,num[i]);
    }
    ll l=1,r=maxn,mid;
    while(l<=r){
        mid=(l+r)>>1;
        if(judge(mid)){
            l=mid+1;
        }
        else {
            r=mid-1;
        }
    }
    cout<<r<<endl;
    getchar();
    getchar();
    return 0;
}
